package com.sicau.tools;

import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;

public class WebScrapingTool {

    @Tool(description = "网页抓取")
    public String scrapeWebsite(@ToolParam (description = "网页地址") String url) {
        try {
            Connection connect = Jsoup.connect(url);
            return connect.get().html();
        } catch (Exception e) {
            return "网页解析失败";
        }
    }

}
